package com.lazyfish.scss.util;

import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpServletRequest;

public class ValidateJson {
	public static JSONObject verification(HttpServletRequest request, String...args) {
		JSONObject json;
		try {
			json = GetRequestJsonUtils.getRequestJsonObject(request);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("无法解析json数据。");
			return null;
		}
		for (String string : args) {
			String temp = json.getString(string);
				if(temp==null || temp.equals("")){
					System.out.println(string+"字段缺少数据。");
					return null;
				}
		}
		return json;
	}
}
